package com.qidianit.mes.pro.controller;

import com.qidianit.mes.common.Result;
import com.qidianit.mes.pro.service.ProscheduleService;
import com.qidianit.mes.vo.ProductionOrderPageVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Package Path: com.qidianit.mes.pro.controller
 * Author: Alhz
 * Description:
 * Date: 2025/9/23 19:29
 */
@RestController
@RequestMapping("/proschedule")
public class ProscheduleController {
    @Autowired
    private ProscheduleService proscheduleService;

    /**
     * 获取所有通过审核的工单
     * @param productionOrderPageVo
     * @return
     */
    @GetMapping("/getStatus")
    public Result getStatus(ProductionOrderPageVo productionOrderPageVo,
                            @RequestParam(defaultValue = "1") int page,
                            @RequestParam(defaultValue = "10") int pageSize){
        return proscheduleService.selectAllProductionOrders(productionOrderPageVo,page,pageSize);
    }

    /**
     * 根据id获取对应的信息
     * @param id
     * @return
     */
    @GetMapping("/getProductionOrderAllInfo/{id}")
    public Result getProductionOrderAllInfo(@PathVariable Long id){
        return proscheduleService.selectProductionOrderById(id);
    }


    @GetMapping("/getAllWorkFlowProcessByProductCode/{code}")
    public Result getAllWorkFlowProcessByProductCode(@PathVariable String code){
        return  proscheduleService.selectWorkFlowProcess(code);
    }


}
